/**
 * Created by WLG on 2018/11/12.
 */
global.commonUtil = require('./lib/commonUtil');
const databaseManager = require('./lib/databaseManager');
databaseManager.init();

let AccountMemService = require('./services/accountMemService');
let ChatService = require('./services/chatService');
let ChatMemInfoService = require('./services/ChatMemInfoService');

 setTimeout(async() => {

     /*await AccountMemService.save(
         {
             accountID:  "A111",
             username: "111",
             name: "王鹏",
             avatar: "http://www.app4cm.cn/tocim/head/111.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A222",
             username: "222",
             name: "常庆顺",
             avatar: "http://www.app4cm.cn/tocim/head/222.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A333",
             username: "333",
             name: "钟霖芬",
             avatar: "http://www.app4cm.cn/tocim/head/333.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A444",
             username: "444",
             name: "武君豪",
             avatar: "http://www.app4cm.cn/tocim/head/444.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A555",
             username: "555",
             name: "陈晓洋",
             avatar: "http://www.app4cm.cn/tocim/head/555.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A666",
             username: "666",
             name: "王立刚",
             avatar: "http://www.app4cm.cn/tocim/head/666.png"
         }
     );*/

     /*
     await AccountMemService.save(
         {
             accountID:  "A111",
             id: "111",
             name: "王鹏",
             avatar: "http://www.app4cm.cn/tocim/head/000.png"
         }
     );
     await AccountMemService.save(
         {
             accountID:  "A111",
             id: "222",
             name: "常庆顺",
             avatar: "http://www.app4cm.cn/tocim/head/000.png"
         }
     );

     await ChatService.save(
         {
             id: "111",
             accountID:  "111",
             chatType: "20001",
             title: "大王鹏，王鹏大",
             mem: ["111","222"],
             desc: "讨薪小组",
             approval: "0",
             allowInvites: "1",
             avatar: "http://www.app4cm.cn/tocim/head/000.png",
             createTime: "",
             updateTime: "",
             status: "1",
             lastChatContent: "",
             lastChatTime: "",
             lastChatSender: "",
         }
     );
     await AccountMemService.save(
      {
      accountID:  "A777",
      username: "777",
      name: "付长松",
      avatar: "http://www.app4cm.cn/tocim/head/777.png"
      }
     );
*/
    /* let list = await ChatMemInfoService.searchByMemId('111');
     console.log(list);
     console.log('=======================================');
     let list2 = await ChatMemInfoService.searchByMemId('111',list[2].lastReadTime);
     console.log(list2);*/

     //let result = null;
     //result = await ChatMemInfoService.searchChatAndChatMemByMemId('111');
     //console.log(result);



 }, 500);